#!/bin/bash

client=$1
server=$2
hops=$3
seed=$4

n1="10.0.0.$(expr $client + 1)"
n2="10.0.0.$(expr $server + 1)"
#read -p "Introduza ultimo numero ip emissor... " n1
#read -p "Introduza ultimo numero ip destino... " n2
echo "Waf running with client =" $client " server = "$server
echo "$n1  --->   $n2    seed=$seed"
./waf --run "scratch/gpsr2 --client=$client --server=$server --seed=$seed" &> LOF
echo "waf done.."

result=$(grep -c "RouteOutput from $n1 destination $n2" LOF)

echo "Num TX: $result"


result2=$(grep -c " Unicast local delivery to $n2 from $n1" LOF)

echo "Num RX: $result2"


taxa=$(expr $result2 / 60)
perc=$(expr $taxa * 100)

echo "TX 60 " RX " $result2 " PDR " $perc" >> PDR$hops 

echo "Done!"
